﻿using OOAD_PROJEKAT;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfApplication25;
using covjece;

namespace Main_application
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    /// 
    public partial class MainWindow : Window
    {
        Window1 login;
        Klijent sama;
        bool logu;
        public MainWindow(Window1 proba, Klijent kopija)
        {
            InitializeComponent();
            login = proba;
            sama = kopija;
            logu = false;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            covjece.MainWindow igra = new covjece.MainWindow();
            igra.ShowDialog();
        }

        private void prikazi(Label prvi)
        {
            prvi.Visibility = Visibility.Visible;
            prvi.Opacity = 0;
            DoubleAnimation animacija = new DoubleAnimation(1, TimeSpan.FromSeconds(0.5));
            prvi.BeginAnimation(Label.OpacityProperty, animacija);
            SoundPlayer zvuk = new SoundPlayer(Properties.Resources.button);
            zvuk.Play();
        }

        private void sakrij(Label prvi)
        {
            DoubleAnimation animacija = new DoubleAnimation(0, TimeSpan.FromSeconds(0.5));
            prvi.BeginAnimation(Label.OpacityProperty, animacija);
        }

        private void Button_MouseEnter(object sender, MouseEventArgs e)
        {
            prikazi(prvi);
        }

        private void Button_MouseLeave(object sender, MouseEventArgs e)
        {
            sakrij(prvi);
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Da li ste sigurni da se želite odjaviti?", "Logout", MessageBoxButton.YesNo, MessageBoxImage.None) == MessageBoxResult.Yes)
            {
                logu = true;
                Close();
            }
        }

        private void Button_MouseEnter_1(object sender, MouseEventArgs e)
        {
            prikazi(druga);
        }

        private void Button_MouseLeave_1(object sender, MouseEventArgs e)
        {
            sakrij(druga);
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            prijaviGresku proz = new prijaviGresku(sama);
            proz.ShowDialog();
        }

        private void Button_MouseEnter_2(object sender, MouseEventArgs e)
        {
            prikazi(treci);
        }

        private void Button_MouseLeave_2(object sender, MouseEventArgs e)
        {
            sakrij(treci);
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            Licna korisnik = new Licna(sama);
            korisnik.ShowDialog();
        }

        private void Button_MouseEnter_3(object sender, MouseEventArgs e)
        {
            prikazi(cetvrti);
        }

        private void Button_MouseLeave_3(object sender, MouseEventArgs e)
        {
            sakrij(cetvrti);
        }

        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            ponuda pon = new ponuda();
            pon.ShowDialog();
        }

        private void Button_MouseEnter_4(object sender, MouseEventArgs e)
        {
            prikazi(peti);
        }

        private void Button_MouseLeave_4(object sender, MouseEventArgs e)
        {
            sakrij(peti);
        }

        private void glavni_Closed(object sender, EventArgs e)
        {
            if (logu == true)
            {
                logu = false;
                login.ShowDialog();
            }
            else
                login.Close();
        }


    }
}
